package cn.com.miao.lynx.plugin.job.quartz.wrapper.support;

import cn.com.miao.lynx.plugin.job.quartz.wrapper.JobParamWrapper;
import cn.com.miao.lynx.plugin.job.quartz.wrapper.JobWrapper;
import lombok.Builder;
import lombok.Getter;
import org.springframework.scheduling.quartz.QuartzJobBean;

import java.util.Date;

/**
 * CronJobWrapper
 *
 * @title: CronJobWrapper
 * @description:
 * @author: dengmiao
 * @create: 2020-01-14 15:12
 **/
@Getter
public class CronJobWrapper extends JobWrapper {

    /**
     * cron表达式
     * 任务执行方式如果为CRON_EXPRESSION时，该方法必须调用并设置值
     */
    private String cron;

    /**
     * 构造函数初始化父类的相关字段
     * @param jobKey       任务key
     * @param cron         cron表达式
     * @param jobClass     执行任务类
     * @param param 参数封装对象
     */
    @Builder(builderMethodName = "Context", buildMethodName = "wrapper")
    public CronJobWrapper(String jobKey, Class<? extends QuartzJobBean> jobClass, Date startAtTime, JobParamWrapper param, String cron) {
        super(jobKey, jobClass, startAtTime, param);
        this.cron = cron;
    }
}
